<?php
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
define(VOCAB_CATEGORY_ID, variable_get('vocab_category_id', 0));
define(VOCAB_POTENCY_ID, variable_get('vocab_potency_id', 0));
define(VOCAB_FORM_ID, variable_get('vocab_form_id', 0));
?>
<?php
foreach ($data as $item) {
    $url = url('node/' . $item->nid);
    $image_path = base_path() . imagecache_create_path('product_special_offer', $item->field_image_cache[0]['filepath']);
    $add_to_cart = theme('uc_product_add_to_cart', $item);
    $price = uc_price(array('price' => $item->sell_price, 'qty' => 1), array('revision' => 'formatted'));
    $terms_map = array('category' => array(), 'form' => array(), 'potency' => array());
    foreach ($item->taxonomy as $term) {
        switch ($term->vid) {
            case VOCAB_CATEGORY_ID:
                $terms_map['category'][] = $term;
                break;
            case VOCAB_POTENCY_ID:
                $terms_map['form'][] = $term;
                break;
            case VOCAB_FORM_ID:
                $terms_map['potency'][] = $term;
                break;
        }
    }
?>

    <div class="osnProduct">
        <div class="saleLabel">Sale - XX% Off
            <span class="limit">No limit</span>
        </div>
        <div class="productIncludeWrapper">
            <div class="productImg">
                <a href="<?php print $url; ?>"><img src="<?php print $image_path; ?>" class="productImageContainerLeft" /></a>
            </div>
            <div class="productIncludeDetailsRight">
                <ul>
                    <li class="productName"><a href="<?php print $url; ?>"><?php print substr($item->title, 0, 10) . '...'; ?></a></li>
                    <li class="productDetails"><?php //print $item->model; ?></li>
                <?php
//                foreach ($terms_map['category'] as $value) {
//                    print "<li class='producyTaxonomy'><a href='" . url('taxonomy/' . $value->tid) . "'>$value->name</a></li> ";
//                }
                ?>
                <?php
                //foreach ($terms_map['potency'] as $value) {
                    print "<li class='producyPotency'><a href='" . url('taxonomy/' . $terms_map['potency'][0]->tid) . "'>".$terms_map['potency'][0]->name."</a></li> ";
                //}
                ?>
                <?php
                //foreach ($terms_map['form'] as $value) {
                    print "<li class='producyPotency'><a href='" . url('taxonomy/' . $terms_map['form'][0]->tid) . "'>".$terms_map['form'][0]->name."</a></li> ";
                //}
                ?>
                <li class="salePrice"> <?php print $price ?> </li>
            </ul>
        </div>
    </div>
    <?php print $add_to_cart; ?>
            </div>

<?php } ?>